package com.neu.smty.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.neu.common.annotation.Log;
import com.neu.common.core.controller.BaseController;
import com.neu.common.core.domain.AjaxResult;
import com.neu.common.enums.BusinessType;
import com.neu.smty.domain.PhysicalExamProject;
import com.neu.smty.service.IPhysicalExamProjectService;
import com.neu.common.utils.poi.ExcelUtil;
import com.neu.common.core.page.TableDataInfo;

/**
 * 项目管理1Controller
 * 
 * @author liningning
 * @date 2025-10-10
 */
@RestController
@RequestMapping("/smty/project")
public class PhysicalExamProjectController extends BaseController
{
    @Autowired
    private IPhysicalExamProjectService physicalExamProjectService;

    /**
     * 查询项目管理1列表
     */
    @PreAuthorize("@ss.hasPermi('smty:project:list')")
    @GetMapping("/list")
    public TableDataInfo list(PhysicalExamProject physicalExamProject)
    {
        startPage();
        List<PhysicalExamProject> list = physicalExamProjectService.selectPhysicalExamProjectList(physicalExamProject);
        return getDataTable(list);
    }

    /**
     * 导出项目管理1列表
     */
    @PreAuthorize("@ss.hasPermi('smty:project:export')")
    @Log(title = "项目管理1", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(PhysicalExamProject physicalExamProject)
    {
        List<PhysicalExamProject> list = physicalExamProjectService.selectPhysicalExamProjectList(physicalExamProject);
        ExcelUtil<PhysicalExamProject> util = new ExcelUtil<PhysicalExamProject>(PhysicalExamProject.class);
        return util.exportExcel(list, "project");
    }

    /**
     * 获取项目管理1详细信息
     */
    @PreAuthorize("@ss.hasPermi('smty:project:query')")
    @GetMapping(value = "/{projectId}")
    public AjaxResult getInfo(@PathVariable("projectId") Long projectId)
    {
        return AjaxResult.success(physicalExamProjectService.selectPhysicalExamProjectById(projectId));
    }

    /**
     * 新增项目管理1
     */
    @PreAuthorize("@ss.hasPermi('smty:project:add')")
    @Log(title = "项目管理1", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PhysicalExamProject physicalExamProject)
    {
        return toAjax(physicalExamProjectService.insertPhysicalExamProject(physicalExamProject));
    }

    /**
     * 修改项目管理1
     */
    @PreAuthorize("@ss.hasPermi('smty:project:edit')")
    @Log(title = "项目管理1", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PhysicalExamProject physicalExamProject)
    {
        return toAjax(physicalExamProjectService.updatePhysicalExamProject(physicalExamProject));
    }

    /**
     * 删除项目管理1
     */
    @PreAuthorize("@ss.hasPermi('smty:project:remove')")
    @Log(title = "项目管理1", businessType = BusinessType.DELETE)
	@DeleteMapping("/{projectIds}")
    public AjaxResult remove(@PathVariable Long[] projectIds)
    {
        return toAjax(physicalExamProjectService.deletePhysicalExamProjectByIds(projectIds));
    }
}
